<template>
  <view :style="themeColor">
    <view class="page">
      <view
        class="flex flex-direction flex-wrap align-stretch justify-center benben-position-layout flex woyoujianyi_flex_0"
        :style="{height:(88+StatusBarRpx)+'rpx',paddingTop:StatusBarRpx+'rpx', }">
        <view class='flex flex-wrap align-stretch justify-between woyoujianyi_fd0_0'>
          <view class='flex flex-wrap align-center woyoujianyi_fd0_0_c0' @tap.stop="handleJumpDiy" data-type="back"
            data-url="1">
            <text class='fu-iconfont2  woyoujianyi_fd0_0_c0_c0'>&#xe794;</text>
          </view>
          <view class='flex flex-wrap align-center'>
            <text class='woyoujianyi_fd0_0_c1_c0'>我有建议</text>
          </view>
          <view class='flex align-center justify-end woyoujianyi_fd0_0_c2' @tap.stop="handleJumpDiy"
            data-type="navigateTo" :data-url="`/pages/xtsz/feedBackDetail/feedBackDetail`">
          </view>
        </view>

      </view>
      <view :style="{height: (88+StatusBarRpx)+'rpx'}"></view>
      <!---flex布局flex布局开始-->
      <view class="flex flex-direction align-stretch benben-flex-layout woyoujianyi_flex_1">
        <view class='flex flex-wrap align-center flex-sub woyoujianyi_fd1_0'>

          <view class='flex  woyoujianyi_fd1_0_c0'></view>

          <text class='woyoujianyi_fd1_0_c1'>姓名</text>
        </view>
        <view class='flex flex-direction align-stretch'>
          <view class='flex flex-wrap align-center flex-sub woyoujianyi_fd1_1_c0'>
            <benben-input class='flex-sub woyoujianyi_fd1_0' type="text" :placeholder="`请输入`" confirm-type="done"
              :maxlength="10" v-model="xingming" :adjust-position='true'
              placeholder-style="color:#999;font-size:28rpx" />
          </view>
          <view class='flex flex-wrap align-center flex-sub woyoujianyi_fd1_0'>

            <view class='flex  woyoujianyi_fd1_0_c0'></view>

            <text class='woyoujianyi_fd1_0_c1'>联系方式</text>
          </view>
        </view>
        <view class='flex flex-wrap align-center flex-sub woyoujianyi_fd1_1_c0'>
          <benben-input class='flex-sub woyoujianyi_fd1_0' type="number" :placeholder="`请输入`" confirm-type="done"
            v-model="contact" :maxlength="11" :adjust-position='true' placeholder-style="color:#999;font-size:28rpx" />
        </view>
        <view class='flex flex-wrap align-center flex-sub woyoujianyi_fd1_0'>

          <view class='flex  woyoujianyi_fd1_0_c0'></view>

          <text class='woyoujianyi_fd1_0_c1'>您的建议</text>
        </view>
        <view class='flex flex-wrap align-center flex-sub woyoujianyi_fd1_1_c0'>
          <benben-input class='flex-sub woyoujianyi_fd1_0' type="text" :placeholder="`请输入`" confirm-type="done"
            v-model="body" :maxlength="-1" :adjust-position='true' placeholder-style="color:#999;font-size:28rpx" />
        </view>
        <view class='flex flex-wrap align-center flex-sub woyoujianyi_fd1_0'>

          <view class='flex  woyoujianyi_fd1_0_c0'></view>

          <text class='woyoujianyi_fd1_0_c1'>上传反馈截图，最多5张（选填）</text>
        </view>
        <view class='flex flex-wrap align-center bg-white'>
          <benben-images-upload ref="benbenImagesUploadfd1_6_c0" :maxlength="5" :img-list.sync="img"
            :img-ids.sync="img_id">
            <template #content="{ num, maxlength, isShow, imgList }">
              <view class="flex flex-wrap align-start flex woyoujianyi_fd1_6_c0">

                <view v-for="(image, index) in imgList" :key="index"
                  class='flex position-relative woyoujianyi_fd1_6_c00'>
                  <text class='fu-iconfont2 position-absolute woyoujianyi_fd1_6_c000'
                    @tap.stop="$refs.benbenImagesUploadfd1_6_c0.delImage(index)">&#xE8E7;</text>
                  <image class='woyoujianyi_fd1_6_c001' @tap.stop="$refs.benbenImagesUploadfd1_6_c0.previewImage(index)"
                    mode="aspectFit" :src='image'></image>
                </view>

                <image class='woyoujianyi_fd1_6_c01' @tap.stop="$refs.benbenImagesUploadfd1_6_c0.manyChooseImage()"
                  v-if="isShow" mode="aspectFit" :src='STATIC_URL+"77.png"'></image>

              </view>
            </template>
          </benben-images-upload>
        </view>
        <button class='woyoujianyi_fd1_7' @click="submit">提交</button>
      </view>

      <!---flex布局flex布局结束-->


    </view>
  </view>
</template>
<script>
  import {
    validate
  } from '@/common/utils/validate.js'
  export default {
    components: {},


    data() {
      return {
        "img": [],
        "img_id": "",
        contact: '',
        body: '',
        xingming: ''
      };
    },
    computed: {
      themeColor() {
        return this.$store.getters.themeColor
      },

    },
    watch: {},
    onLoad(options) {

    },
    onUnload() {

    },
    onReady() {

    },
    onShow() {

    },
    onHide() {

    },
    onResize() {

    },
    onPullDownRefresh() {

    },
    onReachBottom(e) {

    },
    onPageScroll(e) {

    },
    methods: {
      //提交反馈
      async submit() {
        if (!validate(this.xingming, 'require')) {
          this.$message.info('请输入姓名');
          return false;
        }
        if (!validate(this.contact, 'require')) {
          this.$message.info('请输入手机号');
          return false;
        }
        if (!validate(this.contact, 'phone')) {
          this.$message.info('请输入正确的手机号');
          return false;
        }
        if (!validate(this.body, 'require')) {
          this.$message.info('请输入您的建议');
          return false;
        }
        let thumb = ''
        if (this.img.length == 0) {
          thumb = this.img.join(',')
        }
        //请求方法
        //数据验证

        let data6414724b96f3f = await this.$api.dbPost(global.apiUrls.post6414724b96f3f, {
          body: this.body,
          thumb: thumb,
          contact: this.contact,
          xingming: this.xingming
        });
        if (!data6414724b96f3f) return
        if (data6414724b96f3f.data.code != 1) {
          this.$message.info(data6414724b96f3f.data.msg);
          return
        }
        uni.navigateBack()
      },
    }
  };
</script>
<style lang="scss" scoped>
  .page {
    width: 100vw;
    overflow-x: hidden;
    min-height: calc(100vh - var(--window-bottom));
    background: #F8F8F8;
    background-size: 100% auto;
  }

  .woyoujianyi_flex_0 {
    border-bottom: 1px solid #eee;
    background: #fff;
    width: 750rpx;
    height: 88rpx;
    overflow: hidden;
    z-index: 10;
    top: 0rpx;
    background-size: 100% auto !important;
  }

  .woyoujianyi_fd0_0_c2 {
    padding: 0rpx 0rpx 0rpx 0rpx;
    width: 200rpx;
  }

  .woyoujianyi_fd0_0_c1_c0 {
    font-size: 36rpx;
    font-weight: 500;
    color: var(--benbenFontColor0);
    line-height: 50rpx;
  }

  .woyoujianyi_fd0_0_c0_c0 {
    font-size: 36rpx;
    font-weight: 400;
    color: #333;
  }

  .woyoujianyi_fd0_0_c0 {
    width: 200rpx;
  }

  .woyoujianyi_fd0_0 {
    padding: 0rpx 32rpx 0rpx 32rpx;
    line-height: 88rpx;
  }

  .woyoujianyi_flex_1 {
    padding: 24rpx;
  }

  .woyoujianyi_fd1_7 {
    background: #0077FF;
    border-radius: 44rpx;
    width: 686rpx;
    line-height: 88rpx;
    font-size: 32rpx;
    color: #fff;
    height: 88rpx;
    margin: 50rpx auto;
  }

  .woyoujianyi_fd1_6_c01 {
    width: 200rpx;
    height: 200rpx;
    margin: 0rpx 24rpx 24rpx 0rpx;
  }

  .woyoujianyi_fd1_6_c001 {
    width: 200rpx;
    height: 200rpx;
  }

  .woyoujianyi_fd1_6_c000 {
    top: 0rpx;
    right: 0rpx;
    z-index: 10;
    color: #ff5536;
  }

  .woyoujianyi_fd1_6_c00 {
    margin: 0rpx 24rpx 24rpx 0rpx;
  }

  .woyoujianyi_fd1_6_c0 {
    width: 750rpx;
    padding: 24rpx 0rpx 0rpx 24rpx;
  }

  .woyoujianyi_fd1_1_c0 {
    background: var(--benbenbgColor1);
    height: 93rpx;
    line-height: 93rpx;
    background-size: 100% auto;
    border-radius: 16rpx;
  }

  .woyoujianyi_fd1_0_c1 {
    font-size: 32rpx;
    font-weight: 600;
  }

  .woyoujianyi_fd1_0_c0 {
    background: rgba(0, 119, 255, 1);
    width: 6rpx;
    height: 30rpx;
    margin: -6rpx 10rpx 0rpx 10rpx;
  }

  .woyoujianyi_fd1_0 {
    height: 93rpx;
    line-height: 93rpx;
    padding-left: 16rpx;
  }
</style>
